﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TestPlatform.Core;
using Raven.Client;
using TestPlatform.Performer.RavenDB.Entities;

namespace TestPlatform.Performer.RavenDB
{
    public class RavenDBUpdatePerformer : BaseUpdatePerformer
    {
        public override string UnderlyinEngine { get { return "RavenDB"; } }

        public RavenDBUpdatePerformer()
            : base(new RavenDBHelper())
        {

        }

        protected override void UpdateEntity(Guid id)
        {
            using (IDocumentSession s = RavenDBHelper.Store.OpenSession())
            {               
                User user = s.Load<User>(id);
                user.Name = Guid.NewGuid().ToString();

                s.SaveChanges();
            }
        }
    }
}
